<!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport"
		content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
	<meta name="format-detection" content="telephone=no" />
	<meta name="format-detection" content="email=no" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Cache-Control" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
	<title>患者档案-糖尿病合并症</title>
	<!-- 引入 vant UI 组件库样式文件 -->
	<link rel="stylesheet" href="../../common/css/vant-index.css" />
	<style rel="stylesheet">
		body {
			background-color: #f7f8fa;
		}

		a {
			-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		}

		a:-webkit-any-link {
			color: #eee;
		}

		.container {
			border: 1px solid #f5f5f5;
			box-shadow: -1px 5px 5px #ececec;
			border-radius: 10px;
			/* margin: 0.6rem; */
			padding: 0;
		}

		#sub-title {
			margin-top: 0.5rem;
			margin-bottom: 0.5rem;
			margin-left: 1rem;
		}

		.icon {
			display: inline-block;
			background-color: #E22E30;
			width: 0.5rem;
			height: 0.5rem;
			margin-right: 0.5rem;
		}

		.text {
			display: inline-block;
			font-size: 1.1rem;
			font-weight: 450;
			color: #555555;
		}

		.van-cell-group--inset {
			margin: 0;
		}

		.van-cell__title {
			flex: 2;
		}

		.tab-btn {
			margin: 0.2rem;
			height: 1.7rem;
			line-height: 1.7rem;
		}
	</style>
</head>

<body>
	<div id="app" v-cloak>
		<div class="container">
			<van-nav-bar title="糖尿病合并症" left-text="返回" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
				<template #right>
					<van-icon name="wap-home-o" size="18" />
				</template>
			</van-nav-bar>
			<div id="sub-title">
				<div class="icon"></div>
				<div class="text">高血压病</div>
			</div>
			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊情况</span>
					</template>
					<template #value>
						{{currentData.hypertension == 1 ? '确诊有' :
						currentData.hypertension == 2 ? '确诊无' :
						currentData.hypertension == 3 ? '未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊日期</span>
					</template>
					<template #value>
						{{currentData.hypertensionDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">是否服用降压药物</span>
					</template>
					<template #value>
						{{currentData.ifHypotensor == 1 ? '是' :
						currentData.ifHypotensor == 2 ? '否' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">高血压分级</span>
					</template>
					<template #value>
						{{currentData.hypertensionLevel == 1 ?
						'1级高血压（轻度）' : currentData.hypertensionLevel
						== 2 ? '2级高血压（中度）' :
						currentData.hypertensionLevel == 3 ?
						'3级高血压（重度）' : currentData.hypertensionLevel
						== 4 ? '单纯收缩期高血压' : '--'}}
					</template>
				</van-cell>
			</van-cell-group>

			<div id="sub-title">
				<div class="icon"></div>
				<div class="text">高脂血症</div>
			</div>
			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊情况</span>
					</template>
					<template #value>
						{{currentData.hyperlipidemia == 1 ? '确诊有' :
						currentData.hyperlipidemia == 2 ? '确诊无' :
						currentData.hyperlipidemia == 3 ? '未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">高甘油三脂血症-确诊日期</span>
					</template>
					<template #value>
						{{currentData.hypertriglyceridemiaDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">是否服用降脂药物</span>
					</template>
					<template #value>
						{{currentData.ifHypolipidemic1 == 1 ? '是' :
						currentData.ifHypolipidemic1 == 2 ? '否' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">高胆固醇血症-确诊日期</span>
					</template>
					<template #value>
						{{currentData.hypercholesterolemiaDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">是否服用降脂药物</span>
					</template>
					<template #value>
						{{currentData.ifHypolipidemic2 == 1 ? '是' :
						currentData.ifHypolipidemic2 == 2 ? '否' : '--'}}
					</template>
				</van-cell>
			</van-cell-group>

			<div id="sub-title">
				<div class="icon"></div>
				<div class="text">心血管疾病</div>
			</div>
			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊情况</span>
					</template>
					<template #value>
						{{currentData.angiocardiopathy == 1 ? '确诊有' :
						currentData.angiocardiopathy == 2 ? '确诊无' :
						currentData.angiocardiopathy == 3 ? '未确诊' :
						'--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊日期</span>
					</template>
					<template #value>
						{{currentData.angiocardiopathyDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">冠心病</span>
					</template>
					<template #value>
						{{currentData.coronaryType == 1 ?
						'急性冠状动脉综合征' : currentData.coronaryType == 2
						? '经皮冠状动脉介入治疗' : currentData.coronaryType
						== 3 ? '冠状旁路移植术' : currentData.coronaryType
						== 4 ? currentData.coronaryOther :
						currentData.coronaryType == 5 ? '确诊无' :
						currentData.coronaryType == 6 ? '未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">心绞痛</span>
					</template>
					<template #value>
						{{currentData.anginaType == 1 ? '不稳定型心绞痛' :
						currentData.anginaType == 2 ? '稳定型心绞痛' :
						currentData.anginaType == 3 ? '确诊无' :
						currentData.anginaType == 4 ? '未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">心肌梗死</span>
					</template>
					<template #value>
						{{currentData.cardiovascularInfarction == 1 ?
						'确诊有' : currentData.cardiovascularInfarction == 2
						? '确诊无' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">心功能不全</span>
					</template>
					<template #value>
						{{currentData.cardiacInsufficiency == 1 ?
						'心功能代偿期' : currentData.cardiacInsufficiency ==
						2 ? '心衰' : currentData.cardiacInsufficiency == 3 ?
						'确诊无' : currentData.cardiacInsufficiency == 4 ?
						'未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<span class="custom-title">其它</span>
					<br />
					{{currentData.angiocardiopathyOther}}
				</van-cell>
				<van-cell>
					<span class="custom-title">相关检查</span>
					<br />
					{{currentData.angiocardiopathyExam}}
				</van-cell>
			</van-cell-group>

			<div id="sub-title">
				<div class="icon"></div>
				<div class="text">脑血管疾病</div>
			</div>
			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊情况</span>
					</template>
					<template #value>
						{{currentData.cerebrovascular == 1 ? '确诊有' :
						currentData.cerebrovascular == 2 ? '确诊无' :
						currentData.cerebrovascular == 3 ? '未确诊' : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">脑猝中</span>
					</template>
					<template #value>
						{{currentData.strokeType == 1 ? '缺血性脑卒中' :
						currentData.strokeType == 2 ? '出血性脑卒中' :
						currentData.strokeType == 3 ?
						currentData.strokeOther : '--'}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">脑猝中-确诊日期</span>
					</template>
					<template #value> {{currentData.strokeDate}} </template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">急性脑缺血-确诊日期</span>
					</template>
					<template #value>
						{{currentData.ischemiaDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">短暂性脑缺血发作</span>
					</template>
					<template #value>
						{{currentData.transientIschemiaDate}}
					</template>
				</van-cell>
				<van-cell>
					<template #title>
						<span class="custom-title">动脉粥样硬化性CCVD</span>
					</template>
					<template #value> {{currentData.ccvdDate}} </template>
				</van-cell>
				<van-cell>
					<span class="custom-title">其它</span>
					<br />
					{{currentData.cerebrovascularOther}}
				</van-cell>
				<van-cell>
					<span class="custom-title">相关检查</span>
					<br />
					{{currentData.cerebrovascularCheck}}
				</van-cell>
			</van-cell-group>

			<div id="sub-title">
				<div class="icon"></div>
				<div class="text">周围血管疾病</div>
			</div>

			<van-cell-group inset>
				<van-cell>
					<template #title>
						<span class="custom-title">确诊情况</span>
					</template>
					<template #value>
						{{currentData.peripheral == 1 ? '确诊有' :
						currentData.peripheral == 2 ? '确诊无' :
						currentData.peripheral == 3 ? '未确诊' : '--'}}
					</template>
				</van-cell>

				<van-cell>
					所患疾病
					<div v-if="currentData.peripheralType != null">
						<br />
						{{currentData.peripheralType.indexOf(1) != -1 ?
						'外周动脉疾病':''}}
						{{currentData.peripheralType.indexOf(2) != -1 ?
						'外周静脉疾病':''}}
						{{currentData.peripheralType.indexOf(3) != -1 ?
						'动脉瘤':''}}
						{{currentData.peripheralType.indexOf(4) != -1 ?
						'动静脉瘘':''}}
						{{currentData.peripheralType.indexOf(5) != -1 ?
						'周围血管损伤':''}}
					</div>
				</van-cell>

				<van-cell v-show="currentData.peripheralType != null && currentData.peripheralType.indexOf(1) != -1">
					<template #title>
						<span class="custom-title">外周动脉疾病-确诊日期</span>
					</template>
					<template #value> {{currentData.arteryDate}} </template>
				</van-cell>
				<van-cell v-show="currentData.peripheralType != null && currentData.peripheralType.indexOf(2) != -1">
					<template #title>
						<span class="custom-title">外周静脉疾病-确诊日期</span>
					</template>
					<template #value> {{currentData.venousDate}} </template>
				</van-cell>
				<van-cell v-show="currentData.peripheralType != null && currentData.peripheralType.indexOf(3) != -1">
					<template #title>
						<span class="custom-title">动脉瘤-确诊日期</span>
					</template>
					<template #value>
						{{currentData.aneurysmDate}}
					</template>
				</van-cell>
				<van-cell v-show="currentData.peripheralType != null && currentData.peripheralType.indexOf(4) != -1">
					<template #title>
						<span class="custom-title">周围血管损伤-确诊日期</span>
					</template>
					<template #value> {{currentData.injuryDate}} </template>
				</van-cell>
				<van-cell v-show="currentData.peripheralType != null && currentData.peripheralType.indexOf(5) != -1">
					<template #title>
						<span class="custom-title">动静脉瘘-确诊日期</span>
					</template>
					<template #value>
						{{currentData.fistulaDate}}
					</template>
				</van-cell>
			</van-cell-group>
		</div>
	</div>
</body>
<!-- 上线环境用 -->
<script src="../../common/js/vue.global.prod.js"></script>
<!-- 引入 UI 组件库 -->
<script src="../../common/js/vant.min.js"></script>
<!-- axios 接口调用 -->
<script src="../../common/js/axios.min.js"></script>
<script src="../../base.js"></script>

<script type="module">
	import {
		getAction,
		postAction,
		getUrl,
	} from "../../common/js/api/vue3-axios-utils.js";
	const PatientData = {
		data() {
			return {
				url: {
					getInfo: "/102/17/1021702",
					updateInfo: "/102/17/1021701",
				},
				currentData: {},
				patient_url: "../index.html?userid=",
			};
		},
		created() {
			this.getData().catch((error) => {
				console.log(error);
			});
		},
		methods: {
			async getData() {
				let patientId = localStorage.pid;

				this.patient_url = this.patient_url + patientId;

				let url =
					getUrl() + this.url.getInfo + "?patientId=" + patientId;

				const res = await getAction(url);

				const timeHandle = (str) => {
					if (str == null) return str;
					return str.slice(0, 10);
				};

				if (res.data.success) {
					this.currentData = await res.data.result;

					// 时间处理
					let dateRegex =
						/\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])/g;

					for (let property in this.currentData) {
						if (dateRegex.test(this.currentData[property])) {
							this.currentData[property] =
								this.currentData[property].match(
									dateRegex
								)[0];
						}
					}
				}
			},
			onClickLeft() {
				window.location.href = "../filesIndex.html";
			},
			onClickRight() {
				window.location.href =
					"../index.html?userid=" + localStorage.pid;
			},
		},
	};

	const app = Vue.createApp(PatientData);

	app.use(vant);

	// 通过 CDN 引入时不会自动注册 Lazyload 组件
	// 可以通过下面的方式手动注册
	app.use(vant.Lazyload);

	// 调用函数组件，弹出一个 Toast
	// vant.Toast("刷新成功");

	app.mount("#app");
</script>

</html>
